<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<h1>json的深度复制</h1>
		<h6>引入underscore,这个库,检查是否能对下面的深复制</h6>
		<p>看来还是不行，很气</p>
	</body>
	<!--<script type="text/javascript">
		var json1 = {
			"name":"cheng",
			"age":18,
			"fun":function(a){
				console.log(a);
			}
		}
		//json1.fun(123);
		console.log(json1);
		for(i in json1){
			if(i=="age"){
				json1[i] = 19;
			}
		}
		var json2 = JSON.parse(JSON.stringify(json1));
		//var json2 = Object.assign({},json1);
		json2.age = 20;
		console.log(json1,json2);
	</script>-->
	<script src="js/underscore.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var json1 = {
			"name":"cheng",
			"age":18,
			"fun":function(a){
				console.log(a);
			},
			"cen":{
				"type":"javascript"
			}
		}
		var new_json = _.extend({},json1);
		json1.age = 19;
		json1.cen.type = "java";
		console.log(new_json,json1)	
	</script>
</html>
